export default{
	data(){
		return {
			dataList:[],
			pageCount: 0,
			loadmoreStatus: 'loadmore',
			searchForm:{
				name:'',
				page_index: 1,
				page_size: 20,
			}
		}
	},
	methods:{
		// 搜索数据
		upSearchDate(val){
			this.searchForm.name = val
			this.searchForm.page_index = 1
			this.init()
		},
		onScrollToLower(){
			if(this.pageCount > this.searchForm.page_index){
				this.searchForm.page_index++
				this.init()
			}else if(this.pageCount === this.searchForm.page_index){
				this.loadmoreStatus = 'nomore'
			}
		},
		init(){
			this.$reqPost(this.requestUrl, this.searchForm).then( res => {
				this.pageCount = res.Page_Count
				if(this.searchForm.page_index === 1){
					this.dataList = res.Data || []
					if(this.pageCount === this.searchForm.page_index){
						this.loadmoreStatus = 'nomore'
					}
				}else {
					this.dataList = [...this.dataList, ...res.Data]
				}
			})
		}
	}
}